<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Vue demo12(过渡系统)</title>
    <script src="../build/vue.js"></script>
    <style>
        .expand-transition {
            transition: all .3s ease;
            height: 30px;
            padding: 10px;
            background-color: #eee;
            overflow: hidden;
        }

        .expand-enter, .expand-leave {
            height: 0;
            padding: 0 10px;
            opacity: 0;
        }
    </style>
</head>
<body>
<div id="app">
    <div>
        <h2>基本用法</h2>
        <div v-if="show" transition="expand">Hello</div>
        <button @click="changeShow">Toggle</button>
    </div>
</div>
<script>
    var vm = new Vue({
        el: '#app',
        data: {
            show: false
        },
        methods: {
            changeShow: function (event) {
                this.show = !this.show;
            }
        }
    });
//    Vue.transition('expand', {
//        beforeEnter: function (el) {
//            el.textContent = 'beforeEnter'
//        },
//        enter: function (el) {
//            el.textContent = 'enter'
//        },
//        afterEnter: function (el) {
//            el.textContent = 'afterEnter'
//        },
//        enterCancelled: function (el) {
//            // handle cancellation
//        },
//        beforeLeave: function (el) {
//            el.textContent = 'beforeLeave'
//        },
//        leave: function (el) {
//            el.textContent = 'leave'
//        },
//        afterLeave: function (el) {
//            el.textContent = 'afterLeave'
//        },
//        leaveCancelled: function (el) {
//            // handle cancellation
//        }
//    });
</script>
</body>
</html>